import java.util.Arrays;
import java.util.Scanner;

public class Main {


    //字母收集
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        char[][] arr = new char[n+1][m+1];
        for (int i = 1; i <= n; i++) {
            String s = in.next();
            for (int j = 1; j <= m; j++) {
                arr[i][j] = s.charAt(j-1);
            }
        }
        int[][] dp = new int[n+1][m+1];
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                dp[i][j] = Math.max(dp[i-1][j],dp[i][j-1])+getScore(arr[i][j]);
            }
        }
        System.out.println(dp[n][m]);
    }
    private static int getScore(char c){
        if (c == 'l') return 4;
        if (c == 'o') return 3;
        if (c == 'v') return 2;
        if (c == 'e') return 1;
        return 0;
    }


    //数组中的最长连续子序列
    public int MLS(int[] arr){
        if(arr == null || arr.length == 0){
            return 0;
        }
        Arrays.sort(arr);
        int _mls = -1;
        int count = 0;
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] == arr[i-1]) continue;
            if (arr[i] - arr[i-1] == 1){
                count = count +1;
            }else{
                count = 1;
            }
            _mls = Math.max(_mls,count);
        }
        return _mls;
    }


    //求最小公倍数
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int n = gdc(a,b);
        System.out.println(a*b/n);
    }
    public static int gdc(int a,int b){
        if(a==b){
            return a;
        }
        if(a<b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        int c = a%b;
        while(c>0){
            a = b;
            b = c;
            c = a%b;
        }
        return b;
    }
}
